/*
n m
l r x

n头奶牛 m轮比赛
第i轮删除[l, r],仅剩x
每轮被谁击败的
*/

#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
#include <set>
using namespace std;
#define DEBUG
const int N=3e5+10;
int n, m;
set<int> st;
int ans[N];

void init()
{
    read(n); read(m);
    for(int i=1; i<=n; i++)
        st.insert(i);
}

void solve()
{
    init();
    for(int i=1; i<=m; i++)
    {
        int l, r, x;
        read(l); read(r); read(x);
        auto it=st.lower_bound(l); //>=
        while(it!=st.end()&&*it<=r)
            if(*it==x) it++;
            else
            {
                ans[*it]=x;
                it=st.erase(it); //删除后自动移至下一个节点
            }
    }
    for(int i=1; i<=n; i++)
        quickwrite(ans[i]), putchar(' ');
    puts("");
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}